{extend name="index_base" /} {block name="seo"}
<title>编辑帖子 - {$site_config['site_title']} - {$site_config['seo_title']}</title>


<meta name="keywords" content="{$site_config['seo_keyword']}">
<meta name="description" content="{$site_config['seo_description']}"> {/block} {block name="css"}
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.9.1.min.js"></script>
{/block} {block name="body"}
<div class="layui-container fly-marginTop">
    <div class="fly-panel" pad20="" style="padding-top: 5px;">
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title">
                <li class="layui-this">编辑帖子</li>
            </ul>
            <div class="layui-form layui-form-pane" style="padding: 20px 0;">

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">板块</label>
                        <div class="layui-input-inline">
                            <select name="tid">
													{volist name="tptcs" id="vo"}
																<option {if condition="$tptc['tid'] eq $vo['id']"}selected="selected"{/if} value="{$vo.id}">{$vo.name}</option>
																{/volist}
													</select>
                        </div>

                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$tptc.title}">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <div class="layui-input-block">
                        <textarea id="content" name="content" lay-verify="content"  style="height:400px;width: 100%;">{$tptc.content}</textarea>
                    </div>
                    <label for="L_content" class="layui-form-label" style="top: -2px;">内容</label>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">浏览方式</label>

                    <div class="layui-input-block">
                        <input type="radio" name="viewtype" lay-filter="linktype" value="0" title="自由浏览" {if $viewtype eq 0} checked {/if} />
                        <input type="radio" name="viewtype" lay-filter="linktype" value="1" title="付费浏览" {if $viewtype eq 1} checked {/if}>
                        <input type="radio" name="viewtype" lay-filter="linktype" value="2" title="回复可见" {if $viewtype eq 2} checked {/if}>
                    </div>

                </div>
                <input type="hidden" name="oldviewtype" value="{$viewtype}">
                <div class="layui-form-item" id="viewscore" {if $viewtype neq 1} style="display:none" {/if}>
                    <label for="L_title" class="layui-form-label">付费积分</label>
                    <div class="layui-input-inline">
                        <input type="number" style="width:100px;text-align:center" name="score" value="{$score}" min="1" autocomplete="off" class="layui-input">
                    </div>
                </div>
                {:hook('attachlinkadd',array('id'=>$tptc['id'],'type'=>2))}

                <div class="layui-form-item">
                    <button class="layui-btn" lay-submit="" lay-filter="forum_edit">提交修改</button>
                </div>

            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/plugins/ace/ace.js"></script>
<script type="text/javascript" src="__PUBLIC__js/formadd.js"></script>
{/block} {block name="script"}


<script>
    layui.use('form', function() {
        var form = layui.form,
            jq = layui.jquery;
        
        form.on('submit(forum_edit)', function(data) {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            });
            //  data.filed.content=jq('#textarea').val();
            var param = data.field;
            jq.post('{:url("bbs/forum/edit",array("id"=>$tptc.id))}', param, function(data) {
                if (data.code == 200) {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    }, function() {
                        location.href = '{:url("bbs/index/thread",array("id"=>$tptc["id"]))}';
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 2,
                        anim: 6,
                        time: 1000
                    });
                }
            });
            return false;
        });

    })
</script>
{/block}